import axios from "axios"
export function request(config) {
    const instance = axios.create({
        baseURL: 'https://api.shop.eduwork.cn',
        timeout: 5000
    })

    instance.interceptors.request.use(config => {
        // get请求映射params参数
        if (config.method === 'get' && config.params) {
            let url = config.url + '?' + tansParams(config.params);
            url = url.slice(0, -1);
            config.params = {};
            config.url = url;
        }
        return config;
    }, err => {
    return Promise.reject(err)
    })
    instance.interceptors.response.use(res => {
        return res;
    }, err => {})
    return instance(config)
}